package com.example.blog.enums;

import org.springframework.util.StringUtils;

/**
 * @author admin
 * 评论美剧
 */

public enum CommentEnum {
    POST("1", "帖子"),
    COMMENT("2", "评论");
    private String code;

    private String description;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    private CommentEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static CommentEnum get(String code) {
        if (StringUtils.hasLength(code)) {
            for (CommentEnum element : CommentEnum.values()) {
                if (element.getCode().equals(code)) {
                    return element;
                }
            }
        }
        return null;
    }
}
